import request from './request.js';
let service = request.service;
let download = request.download;
export default {
    customersList(data) {
        /**获取客户信息列表 */
        return service({
            url: `/adscm/operation/cgxsTaskinfo/queryByKhxx`,
            method: 'get',
            params:data
        })
    },
    purchasesPersonList(data) {
        /**获取人员列表  roleid： 采购-128 库房人员-129  财务人员-finance*/
        return service({
            url: `/adscm/operation/cgxsTaskinfo/queryByYY`,
            method: 'get',
            params: data
        })
    },
    CgxsTaskinfo(data) {
        /**获取采购任务列表*/
        return service({
            url: `/adscm/operation/cgxsTaskinfo/selectCgxsTaskinfo`,
            method: 'post',
            data
        })
    },
    cgbTaskList(data) {
        /**获取采购任务列表*/
        return service({
            url: `/adscm/operation/cgxsTaskinfo/queryByRwlx`,
            method: 'get',
            params: data
        })
    },
    baseBomGetDraw(parentId) {
        /**基础bom -图纸列表获取 */
         return service({
             url: `/adscm/operation/cg/cgBom/selectDrawByParentId/${parentId}`,
             method: 'get'
         })
    },
     baseBomGetBom(drawId) {
         /**根据图纸id -bom列表获取 */
         return service({
             url: `/adscm/operation/cg/cgBom/selectByDrawId/${drawId}`,
             method: 'get'
         })
     },
     baseBomAddUpdateBom(type,data){
         /**根据图纸id insert-新增bom update-修改bom */
         return service({
             url: `/adscm/operation/cg/cgBom/${type}`,
             method: 'post',
             data
         })
     },
     deleteBaseBom(id) {
         /**根据删除bom关联物料*/
         return service({
             url: `/adscm/operation/cg/cgBom/delete/${id}`,
             method: 'post'
         })
     },
    supplierCode(type) {
            /**供应商基础信息码表 */
            /**4-机器型号
             * 5-发票类型
             * 6-付款方式
             * 7-运输方式
             */
            return service({
                url: `/adscm/operation/machinetype/queryByMachineType/${type}`,
                method: 'get',
            })
        },
        supplierAllList(){
            /**获取所有供应商列表 */
            return service({
                url: `/adscm/operation/cg/cgSupplier/selectAll`,
                method: 'post'
            })
        },
        supplierList(data) {
            /**获取供应商列表 */
            return service({
                url: `/adscm/operation/cg/cgSupplier/selectCgSupplier`,
                method: 'post',
                data
            })
        },
        addUpdateSupplier(type, data) {
            return service({
                url: `/adscm/operation/cg/cgSupplier/${type}`,
                method: 'post',
                data
            })
        },
        getDrawBomsList(){
            /**供应商与bom 获取机器图纸信息 */
            return service({
                 url: `/adscm/operation/cg/cgBomSupplierSupplier/selectDrawBoms`,
                 method: 'post'
            })
        },
        getBomList(data) {
             /**供应商与bom 根据图纸id获取bom列表 */
            return service({
                url: `/adscm/operation/cg/cgBomSupplierSupplier/selectBoms`,
                method: 'post',
                data
            })
        },
        getSupplierList(bid) {
            /**供应商与bom 根据bid获取关联供应商列表 */
            return service({
                url: `/adscm/operation/cg/cgBomSupplierSupplier/selectByBid/${bid}`,
                method: 'post'
            })
        },
        addUpdateAboutSupplier(type,data) {
              /**供应商与bom 新增或修改关联供应商*/
            return service({
                  url: `/adscm/operation/cg/cgBomSupplierSupplier/${type}`,
                  method: 'post',
                  data
            })
        },
        addPurcharePlan(data) {
            /**创建采购计划 */
            return service({
                url: `/adscm/operation/cg/cgPurchasePlan/insert`,
                method: 'post',
                data
            })
        },
        updatePurcharePlan(data) {
            /**修改采购计划 */
            return service({
                url: `/adscm/operation/cg/cgPurchasePlan/update`,
                method: 'post',
                data
            })
        },
        purcharePlanList(data) {
            /**采购计划列表 */
            return service({
                url: `/adscm/operation/cg/cgPurchasePlan/select`,
                method: 'post',
                data
            })
        },
        cgBomAllList(){
            /**获取所有bom列表 */
             return service({
                 url: `/adscm/operation/cg/cgBom/selectAll`,
                 method: 'post',
             })
        },

        approveSingle(id){
           /** 单个审核通过*/
            return service({
                url: `/adscm/operation/cg/cgPurchasePlan/approve/${id}`,
                method: 'post',
            })
        },
        approvesMultiple(data){
             /** 多个审核通过*/
             return service({
                 url: `/adscm/operation/cg/cgPurchasePlan/approves`,
                 method: 'post',
                 data
             })
        },

        addUpdateCgtask(type,data){
            /**新增或修改采购任务*/
            return service({
                url: `/adscm/operation/cg/cgTask/${type}`,
                method: 'post',
                data
            })
        },
        cgtaskList(data) {
            /**采购任务列表 */
            return service({
                url: `/adscm/operation/cg/cgTask/select`,
                method: 'post',
                data
            })
        },
        addUpdateCgTaskDetail(type, data) {
            /**新增修改采购任务详情 */
            return service({
                url: `/adscm/operation/cg/cgTaskDetail/${type}`,
                method: 'post',
                data
            })
        },
      cgTaskDetailList(tid) {
           /**采购任务列表*/
           return service({
               url: `/adscm/operation/cg/cgTaskDetail/selectByTid/${tid}`,
               method: 'post'
           })
      },
      cgPdfData(id){
        /**采购任务pdf数据 */
          return service({
              url: `/adscm/operation/cg/cgTask/selectCgOrderBy/${id}`,
              method: 'post'
          })
      },
      sendEmail(data){
        /**采购任务pdf数据 */
        return service({
            url: `/adscm/operation/cg/cgTask/sendEmail`,
            method: 'post',
            data
        })
      },
      supplierBybom(data) {
          /**根据bomid查询对应关联供应商 */
           return service({
               url: `/adscm/operation/cg/cgBomSupplierSupplier/selectSupplierbyId`,
               method: 'post',
               data
           })
      },
      searchBom(data){
         return service({
             url: `/adscm/operation/cg/cgBomSupplierSupplier/selectBom`,
             method: 'post',
             data
         })
      },
      supplierAndBonChangeBom(data){
           return service({
               url: `/adscm/operation/cg/cgBomSupplierSupplier/updateBom`,
               method: 'post',
               data
           })
      },
      getPaymentSettlement(id){
         return service({
             url: `/adscm/operation/cg/cgTask/selectCgPayOrderBy/${id}`,
             method: 'post'
         })
      },
      /** 基础物料 - 列表*/
      cgMaterialList(data){
        return service({
             url: `/adscm/operation/cg/cgMaterial/select`,
             method: 'post',
             data
        })
      },
      /**基础物料 - 新增和修改 */
      addUpdateMaterial(type,data) {
        return service({
            url: `/adscm/operation/cg/cgMaterial/${type}`,
            method: 'post',
            data
        })
      },
      searchMaterialKeyWord(data) {
          return service({
              url: `/adscm/operation/cg/cgMaterial/selectByKeyWords`,
              method: 'get',
              params:data
          })
      },
    supplierAndBomList(data){
        return service({
            url: `/adscm/operation/cg/cgBomSupplierSupplier/queryBom`,
            method: 'post',
            data
        })
    },
    selectByMid(id){
        return service({
            url: `/adscm/operation/cg/cgBom/selectByMid/${id}`,
            method: 'post'
        })
    },
    oweList(sid,type){
        return service({
            url: `/adscm/operation/cg/cgSuppilerInfo/selectBySid/${sid}/${type}`,
            method: 'post'
        })
    },
    addOweRecord(data){
        return service({
            url: `/adscm/operation/cg/cgSuppilerInfo/insert`,
            method: 'post',
            data
        })
    },
    addShCgTask(data) {
        /** 新增售后采购任务*/
        return service({
            url: `/adscm/operation/cg/cgTask/insertsh`,
            method: 'post',
            data
        })
    },
    cgTaskTotal(data) {
        /** 所有采购任务总金额*/
        return service({
            url: `/adscm/operation/cg/cgTask/selectTotals`,
            method: 'post',
            data
        })
    },
    allCgSupplierByMid(bid) {
        /** 根据物料id获取该物料管理的所有供应商*/
        return service({
            url: `/adscm/operation/cg/cgSupplier/selectByBid/${bid}`,
            method: 'post'
        })
    },
    cgTaskBackCheck(id){
         /** 采购任务返回审核*/
         return service({
             url: `/adscm/operation/cg/cgTaskDetail/delete/${id}`,
             method: 'post'
         })
    },
    allSupplierListHc() {
        /**查询所有供应商列表*/
        return service({
            url: `/adscm/operation/supplier/query`,
            method: 'get',
        })
    },
}
